import { HttpType, TipsType } from "./TsEnums";

/**
 * 3种提示框的参数对象类型
 */
export type TipsOpts = {
    msg?: string | null;
    type?: TipsType;
    time?: number;
    title?: string;
    okText?: string;
    onOk?: any;
    cancelText?: string;
    onCancel?: any;
    inputPattern?: any;
    inputErrorMessage?: string;
    dangerouslyUseHTMLString?: boolean;
};

/**
 * Ajax请求的对象
 */
export type AjaxOption = {
    url?: string;
    method?: HttpType; //请求方法
    data?: any | string | null; //请求体
    timeout?: number; //超时时间
    hasToken?: boolean; //是否要带token
    headers?: any; //请求头
    loading?: boolean; //是否要加全屏loading遮罩
    success?: (res: any, full?: any) => void; //执行成功
    error?: (res: XMLHttpRequest) => void; //XHR对象用的，请求失败
    complete?: () => void; //执行完成
    fail?: (res: any) => void; //CallApi用的，请求完成，但有错误
    exception?: (res: any) => void; //CallApi用的，请求完成，但服务端有异常
};

/**
 * CallApi响应对象
 */
export type ResultModel = {
    code: number;
    data: any;
    msg?: string | null;
};

/**
 * Token响应对象
 */
export type TokenModel = {
    access_token: string;
    expires_in: number;
    refresh_token: string;
    token_type: string;
};

/**
 * 文件信息对象
 */
export type UrlFile = {
    fileName: string;
    extName: string;
    fullName: string;
};

/**
 * 文件扩展信息
 */
export type FileExt = {
    displayUrl?: string;
    icon?: string;
    extName?: string;
    fileName: string;
    isImg?: boolean;
    url: string;
};

/**
 * 主界面中tab项
 */
export type TabItem = {
    name: string;
    fullPath: string;
    title: string;
    isActive: boolean;
};

/******************************************************************************* 下面是系统业务相关 *******************************************************************************/
